Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Another take on #2491. This is done in proper way with unit test added first then working on fixing the issue.
The View class does not reset this->sections after completing the rendering. If multiple views are rendered using the same section name those sections are concatenated and displayed multiple times.
The first idea was to reset section in the render method which was not appropriate as this method works if there is only one section but fails to render other section when multiple sections are used. This is because render method is recessively called to render section so rendering the first section will cause other sections not to be rendered at all.
A different approach is used here. Instead of reseting the section array completely each section is unset separately from sections array after rendering it.
I've included unit test which covers the #2491 issue but views still lack tests for some specific cases so this should be tested.
Untested area contains of testing views with layout which renders multiple sections. Currently we have only test layout which renders a single section.
Before merging this one some additional testing should be made.
Checklist: